data_packet <- function(data,proportion=0.8){
  if (!is.data.frame(data)) {
    stop("The 'data' argument must be a data frame.")
  }
  if(!is.double(proportion)){
    stop("The 'proportion' argument must be a double.")
  }
  set.seed(123)
  trainIndex <- createDataPartition(mydata$diagnosis, p = proportion, list = FALSE, times = 1)
  allIndices <- 1:nrow(mydata)
  testDataIndices <- setdiff(allIndices, trainIndex)
  trainData <- mydata[trainIndex, ]
  testData <- mydata[testDataIndices, ]
  write.csv(trainData,file="train.csv")
  write.csv(testData,file="test.csv")
  
  packeted_data <- list("train_data"=trainData,"test_data"=testData)
  return(packeted_data)
}